package flc.ast.fragment;

import android.app.Dialog;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.stark.chess.BaseChessPlayFragment;
import com.stark.chess.core.GameBoardView;

import java.util.ArrayList;
import java.util.List;

import flc.ast.R;
import flc.ast.activity.ChessSettingActivity;
import flc.ast.databinding.FragmentChessBinding;
import stark.common.basic.view.StkEditText;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link ChessFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class ChessFragment extends BaseChessPlayFragment<FragmentChessBinding> {

    @NonNull
    @Override
    protected GameBoardView getGameBoardView() {
        return mDataBinding.gbvChess;
    }

    @Override
    protected ImageView getBgmCtrlView() {
        return null;
    }

    @Override
    protected View getReplayView() {
        return mDataBinding.tvReplay;
    }

    @Override
    protected View getRegretView() {
        return mDataBinding.tvRegret;
    }

    @Override
    protected int onCreate() {
        return R.layout.fragment_chess;
    }

    @Override
    protected void initView() {
        super.initView();
        mDataBinding.ivChessBack.setOnClickListener(v -> getActivity().finish());
        mDataBinding.ivChessSetting.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()) {
            case R.id.ivChessSetting://设置
                startActivity(ChessSettingActivity.class);
                break;
        }
    }

    @Override
    protected void initData() {
        super.initData();
    }

    @Override
    protected List<int[]> getPieceResList() {
        List<int[]> resultList = new ArrayList<>();
        int[] pieceStyle1 = {R.drawable.b5, R.drawable.b4, R.drawable.b3, R.drawable.b2, R.drawable.b1, R.drawable.b6, R.drawable.b7, R.drawable.a5, R.drawable.a4, R.drawable.a3, R.drawable.a2, R.drawable.a1, R.drawable.a6, R.drawable.a7, R.drawable.selected};
        int[] pieceStyle2 = {R.drawable.d5, R.drawable.d4, R.drawable.d3, R.drawable.d2, R.drawable.d1, R.drawable.d6, R.drawable.d7, R.drawable.c5, R.drawable.c4, R.drawable.c3, R.drawable.c2, R.drawable.c1, R.drawable.c6, R.drawable.c7, R.drawable.selected};
        resultList.add(pieceStyle1);
        resultList.add(pieceStyle2);
        return resultList;
    }
}